class Comment < DatabaseObject

  attr_accessor :id, :text, :time_posted

  def initialize(user, image, text)
    @id = $database.comments.last.id + 1
    @user = user.id
    @image = image.id
    @text = text
    @time_posted = current_time
    raise "user must be User instance" unless user.class == User
    raise "image must be Image instance" unless image.class == Image
    raise "@user must be Integer" unless @user.kind_of? Integer
    raise "@image must be Integer" unless @image.kind_of? Integer
  end

end